package gps.monitor.gpsbootstrap.jt809Server;

import gps.monitor.common.core.base.AbstractBootstrap;
import gps.monitor.common.core.base.AbstractServiceStarter;
import gps.monitor.jt809server.config.Jt809ServerConfig;
import gps.monitor.jt809server.configuration.EnableJt809Service;
import gps.monitor.jt809server.entity.DownPlatformAccount;
import gps.monitor.jt809server.service.LinkStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Arrays;

/**
 * @author cyq
 * @date 2021/11/3
 * @desc talk is cheep,show me the code
 */
@EnableJt809Service
@SpringBootApplication
public class Jt809ServerBootstrap extends AbstractBootstrap {

    @Autowired
    private Jt809ServerConfig jt809ServerConfig;

    @Autowired
    private LinkStatusService linkStatusService;

    @Autowired
    private AbstractServiceStarter starter;



    @Override
    public void loadCustomConfig() {
        //jt809ServerConfig.setPort(123);
    }

    @Override
    public boolean startService() {
        DownPlatformAccount account = new DownPlatformAccount();
        account.setCenterId(80004001);
        linkStatusService.loadDownPlatformAccounts(Arrays.asList(account));
        return starter.start();
    }


}
